﻿using UnityEngine;


public class TweenActionScale: TweenActionBase
{
    private Vector3 value;
    private Vector3 start;
    private Transform target;
    bool to;
    public TweenActionScale(Transform target, Vector3 value, float totalTime,bool to)
    {
        this.totalTime = totalTime;
        this.target = target;
        this.to = to;
        this.value = value;
    }
    public override void OnStart()
    {
        start = target.localScale;
    }
    public override void OnUpdate(float schedule)
    {
        if (target == null)
            return;
        if (to)
            target.localScale = (start * (1 - schedule) + value * schedule);
        else
            target.localScale = (start + value * schedule);
    }
}

